#include <iostream>
using namespace std;

double getAvg(int *arr, int size);

void arrChange(int *arr);

int main(){
    int balance[5] = {1, 2, 3, 4, 5};
    double avg;
    cout << "arr in main: " << balance << endl;
    cout << "*arr in main: " << *balance << endl;
    cout << "&arr in main: " << &balance << endl;
    avg = getAvg(balance, 5);
    cout << "avg:" << avg << endl;

    arrChange(balance);
    for (int i = 0; i <  sizeof(balance) / sizeof(balance[0]); i++){
        cout << "balance change:" << balance[i] << endl;
    }

    return 0;
}

double getAvg(int *arr, int size){
    int i, sum = 0;
    double avg;
    for (i; i <  sizeof(arr) / sizeof(arr[0]); i++){
        sum += arr[i];
    };
    
    avg = sum / size;
    cout << "arr in function: " << arr << endl;
    cout << "*arr in function: " << *arr << endl;
    cout << "&arr in function: " << &arr << endl;
    return avg;
}

void arrChange(int *arr){
    int temp[3] = {1, 2, 3};
    //arr = temp;
    for (int i = 0; i <=  sizeof(arr) / sizeof(arr[0]); i++){
        arr[i] = arr[i] + i;
        cout << "arr change:" << arr[i] << endl;
        //cout << "temp change:" << temp[i] << endl;
    }
    return;
}